<?php
	
class AdminModel extends Model{

	protected $tableName = 'admin'; 

	public function login($info){
		$map['username'] = $info['username'];
		$map['password'] = $info['password'];
		$userinfo = $this->where($map)->find();
		if($userinfo['uid']){
			$_SESSION['WKEIN_LGOIN']    = 1;
			$_SESSION['WKEIN_USERINFO'] = $userinfo;
			$data['logintime'] = time();
			$this->where('uid ='.$userinfo['uid'])->save($data);
			return true;
		}else{
			return false;
		}

	}

	public function loginout(){
		$_SESSION['WKEIN_LGOIN']   	 = 0;
		$_SESSION['WKEIN_USERINFO']  = '';
		return true;
	}
}

?>